extends CanvasLayer

@onready var continue_button: Button = $MarginContainer/PanelContainer/MarginContainer/VBoxContainer/ContinueButton
@onready var retry_button: Button = $MarginContainer/PanelContainer/MarginContainer/VBoxContainer/RetryButton
@onready var quit_button: Button = $MarginContainer/PanelContainer/MarginContainer/VBoxContainer/QuitButton

func _ready() -> void:
	pause()
	continue_button.pressed.connect(on_continue)
	retry_button.pressed.connect(on_retry)
	quit_button.pressed.connect(on_quit)

func pause():
	get_tree().paused = true

func un_pause():
	queue_free()
	get_tree().paused = false

func on_continue():
	# 关闭菜单
	un_pause()
	
func on_retry():
	$"/root/LevelManager".to_current_level()
	un_pause()

func on_quit():
	# 回到标题界面
	$"/root/LevelManager".to_menu()
	un_pause()
